/**
 * 
 */

var url = "index.jsp?inc=./one/";
function general(){
	if(document.getElementById("btnList") != null){
		document.getElementById('btnList').onclick = function(){
//			alert("general");
			var frm = document.hiddenFrm;
			frm.action = url+"list.jsp";
			frm.submit();
		}
	}
	if(document.getElementById('btnInput')!=null){
		document.getElementById('btnInput').onclick=function(){
			var frm = document.hiddenFrm;
			frm.action = url+'input.jsp';
			frm.submit();
			
		}
	}		
	if(document.getElementById('find1')!=null){
		document.getElementById('find1').onclick=function(){
			var frm = document.hiddenFrm;
			frm.find.value = "";
			frm.action = url+'list.jsp';
			frm.submit();
			
		}
	}
	if(document.getElementById('btnModify')!=null){
		document.getElementById('btnModify').onclick=function(){
			location.href = url+'modify.jsp';
		}
	}
	if(document.getElementById('btnDelete')!=null){
		document.getElementById('btnDelete').onclick=function(){
			var b = confirm("삭제 할껀가?");
			if(b){
				var rno = document.hiddenFrm.rno.value;
			location.href = url+'delete_result.jsp&rno='+rno;
			}else{
				alert("삭제 작업이 취소되었어");
			}
		}
	}
	if(document.getElementById('btnView')!=null){
		document.getElementById('btnView').onclick=function(){
			location.href = url+'view.jsp';
		}
	}
}
function goPage(page){
	//location.href = url+"view.jsp&page="+page;
	
	var mf = document.hiddenFrm;
	mf.nowPage.value = page;
	mf.find.value = document.vtable_list_frm.find.value;
	mf.action = 'index.jsp?inc=./one/list.jsp';
	
	mf.submit();
	
}
function goView(page,rno){

	var mf = document.hiddenFrm;
	mf.nowPage.value = page;
	mf.rno.value =rno;
	mf.find.value = document.vtable_list_frm.find.value;
	mf.action = 'index.jsp?inc=./one/view.jsp';
	
	mf.submit();
}
function inputInit(){//input과 관련 모듈
//	alert(document.hiddenFrm.mid.value);
	general();
	
	document.getElementById("btnSave").onclick =function(){
		
		var f = document.hiddenFrm;
//		alert(f.mid.value);
		if((f.mid.value == "")||(f.content.value =="")){
			alert("값을 입력하세요");
			f.mid.focus();
		}else{
			f.submit();
		}
	}
}
function listInit(){
	general();
}
function viewInit(){
	general();
}
function modifyInit(){
	general();
	document.getElementById("btnSave").onclick =function(){
		var f = document.frm;
		if(f.mid.value == ""){
			alert("값을 입력하세요");
			f.mid.focus();
		}else{
			f.submit();
		}
	}
}
function deleteInit(){
//	alert(document.hiddenFrm.mid.value);
	general();
}